var componentLayoutAddressBasePath = componentAddressBasePath+"/dhtmlxLayout_pro";
var themeLayoutAddressBasePath = componentLayoutAddressBasePath;
if(themeAddr != '1'){ 
	themeLayoutAddressBasePath = 'theme/'+themeAddr+'/dhtmlx-style';
}

document.write('<link rel="stylesheet" type="text/css" href="'+themeLayoutAddressBasePath+'/dhtmlxlayout.css">');
document.write('<link rel="stylesheet" type="text/css" href="'+themeLayoutAddressBasePath+'/skins/dhtmlxlayout_dhx_'+getThemeAddrSuffix()+'.css">');
document.write('<script src="'+componentAddressBasePath+'/dhtmlxcommon.js"></script>');
document.write('<script src="'+componentLayoutAddressBasePath+'/dhtmlxlayout.js"></script>');
document.write('<script src="'+componentLayoutAddressBasePath+'/dhtmlxcontainer.js"></script>');

function createLayoutNormal(pattenType,divid,onloadReadyProgressOff){
	var layout = new dhtmlXLayoutObject(divid?divid:document.body,pattenType);
	progressOnAllItem(layout);
	if(onloadReadyProgressOff){
		$(function (){
			progressOffAllItem(layout);
		});
	}
    return layout;
}
function createLayoutFromLayoutCell(pattenType,cell,onloadReadyProgressOff){
	var layout = new dhtmlXLayoutObject(cell,pattenType);
	progressOnAllItem(layout);
	if(onloadReadyProgressOff){
		$(function (){
			progressOffAllItem(layout);
		});
	}
	itemProgressOff(cell);
    return layout;
}

function createLayoutFromTabbarCell(pattenType,cell,onloadReadyProgressOff){
	var layout = cell.attachLayout(pattenType);
	progressOnAllItem(layout);
	if(onloadReadyProgressOff){
		$(function (){
			progressOffAllItem(layout);
		});
	}
    return layout;
}

function createLayoutFromWindow(pattenType,win,onloadReadyProgressOff){
	var layout = win.attachLayout(pattenType);
	progressOnAllItem(layout);
	if(onloadReadyProgressOff){
		$(function (){
			progressOffAllItem(layout);
		});
	}
    return layout;
}


function layoutCellAttachURL(layout,cell,url){
	var c = layout.cells(cell);
	itemProgressOn(c);
	c.attachURL(url);
	iframeLoaded(c.getFrame(),function(){itemProgressOff(c);});
}
function progressOnAllItem(layout){
	layout.forEachItem(function(item){
		itemProgressOn(item);
    });	
}
function progressOffAllItem(layout){
	layout.forEachItem(function(item){
		itemProgressOff(item);
    });	
}
function getCellsSize(layout){
	var i = 0;
	layout.forEachItem(function(item){
		i++;
	});
	return i;
}
function itemProgressOn(item){
	item.progressOn();
}
function itemProgressOff(item){
	item.progressOff();
}
function layoutProgressOn(layout){
	layout.progressOn();
}
function layoutProgressOff(layout){
	layout.progressOff();
}